<template>
  <div class="search_wrap">
    <span @click="back">返回</span>
    <div  class="search">
      {{title}}
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  import {mapGetters, mapMutations} from 'vuex'

  export default {
    props: ['title','type'],
    data() {
      return {
      }
    },
    created() {
    },
    mounted() {
    },
    computed: {},
    methods: {
      back() {
        if(this.type===1){ //只有从订单确认页过来时才会返回待支付页面
            this.$router.replace({
              path: "/myOrder",
              query: {
                type:"0"
              }
            })
        }else{
          this.$router.back()
        }

      }
    },
    components: {},
    watch: {
      '$route'(to, from) {
        if(to.path==='/detial'||to.path==='/search'){
          this.isNav=false
        }else{
          this.isNav=true
        }
      }
    }
  }
</script>

<style scoped lang="scss">
  .search_wrap{
    position: fixed;
    width: 100%;
    z-index: 10;
    top: 0;
    background-color: #efefef;
    padding-bottom: 6px;
    padding-top: 8px;
    max-width: 768px;
    min-width: 320px;
    >span{
      float: left;
      font-size: 13px;
      margin-left: 10px;
      margin-right: 8px;
      padding: 10px;
      letter-spacing: 2px;
      color: #999;
      border-radius: 5px;
      &:active{
        background-color: #ddd;
      }
    }
  }
  .search {
    overflow: hidden;
    position: relative;
    margin-right: 56px;
    height: 32px;
    line-height: 32px;
    font-size: 15px;
    color: #333;
  }
</style>
